<!DOCTYPE html>
<html class="x-admin-sm">

<head>
  {include file="public/head"}
</head>

<body>
  {include file="public/breadcrumb"}
  <form class="layui-form" style="margin-top: 10px;">
    <div class="layui-form-item">
      <label class="layui-form-label">网站名称</label>
      <div class="layui-input-inline">
        <input type="text" class="layui-input" name="title" value="{$site.values}">
      </div>
    </div>
  </form>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" onclick="save()">提交</button>
    </div>
  </div>
  <script>
    layui.use(['layer'], function () {
      $ = layui.jquery;
      layer = layui.layer;
    });

    function save() {
      var title = $.trim($('input[name="title"]').val());
      if (title == '') {
        layer.msg('网站名称不能为空', { 'icon': 2 });
        return;
      }
      $.post('/admin.php/site/save', { 'title': title }, function (res) {
        if (res.code > 0) {
          layer.msg(res.msg, { 'icon': 2 });
        } else {
          layer.msg(res.msg, { 'icon': 1 });
          setTimeout(function () { window.location.reload(); }, 1000);
        }
      }, 'json');
    }
  </script>
</body>

</html>